﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using CLEX.DataContracts;

namespace CLEX.ServiceContracts
{
    [ServiceContract]
    public interface IClientService
    {
        //This is really interesting how this works. 
        //So when this says UriTemplate its just the extension of service.
        //This one is equivalent to this: http://192.168.1.3/ClientService.svc/Login/Justin/Justin
        //So the first extention is like the method you want,
        //then obiously the params are next. If you literally type this into 
        //the browser it should show you "true"
        //if you have any WebGet with params, you need to go this to tell
        //WCF params are coming somehow. I also changed the web config file a bit
        //with a Json setting and setting http behaviors. And of course I
        //test it through the IIS not VS. Also that online example
        //with the vehicles helped me out. I included that on my commit.
        //It's in a zip folder call httpWeb something.....
        [OperationContract]
        [WebGet(
            UriTemplate = "Login/{username}/{password}",
            BodyStyle = WebMessageBodyStyle.WrappedRequest,
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json)]
        bool Login(string username, string password);

        [OperationContract]
        List<DatabaseData> GetDatabaseByOwner(string username);

        [OperationContract]
        List<DatabaseData> GetDatabasesSharedWith(string username);

        [OperationContract]
        void ShareDatabase(int[] databaseId, int userId);
    }
}
